import type { Mapping, Option } from "@/components/ProFrom/ProFrom.vue";
import { reactive, computed } from "vue";
import { useGlobalStore } from "@/stores";
const { dictionary, staffList } = useGlobalStore();

export const queryFormMap: Mapping[] = [
  { label: "值班人员", type: "input", prop: "name", col: 4 },
];

export const levelFormMap = [
  {
    label: "初判标准",
    type: "input",
    prop: "firstStandard",
  },
  {
    label: "响应状态",
    type: "switch",
    prop: "responseStatus",
    option: dictionary.responseStatus,
  },
  {
    label: "应急提醒",
    type: "input",
    prop: "watchWarning",
  },
].map((e) => ({ ...e, required: true })) as Mapping[];

// 使用computed的原因：
// options内容包含 stores中动态更新的值（比如人员列表），需要在改值更新后触发当前FormMap的更新
export const personFormMap = computed(() =>
  [
    {
      label: "响应人员",
      type: "select",
      prop: "staffId",
      options: dictionary.staffId, //staffList
    },
    {
      label: "职位",
      type: "select",
      prop: "position",
      options: dictionary.position,
    },
    // {
    //   label: "所属工作组",
    //   type: "input",
    //   prop: "workingGroup",
    // },
    {
      label: "职责",
      type: "textarea",
      prop: "duty",
    },
  ].map((e) => ({ ...e, required: true }))
);
